<template>
    <div class="pagination">
        <el-pagination
            background
            @current-change="handleCurrentChange"
            @size-change="handleSizeChange"
            v-show="ifShowFn"
            :current-page="curPage"
            :page-sizes="pageSizes"
            :page-size="pageSize"
            :pager-count="5"
            layout="total, sizes, prev, pager, next, jumper"
            :total="dataTotal">
        </el-pagination>
    </div>
</template>


<script>
import bus from './bus';

export default {
    name: 'pagination',
    props: ['dataTotal', 'curPage', 'pageSize'],
    data() {
        return {
            pageSizes: [10, 20, 50, 100,1000,100000]
        };
    },
    created() {
        
    },
    computed: {
        ifShowFn() {
            let _flag = false;

            if (this.dataTotal > 0) {
               _flag = true;
            }

            return _flag;
        }
    },
    methods: {
        handleCurrentChange(val) {
            this.$emit('getCurPage', val);
        },
        handleSizeChange(val) {
            this.$emit('getPageSize', val);
        }
    },
}
</script>